package com.qinsoft.business.permit.dao;

import java.util.ArrayList;
import java.util.List;

import org.apache.ibatis.session.SqlSession;

import com.qinsoft.business.permit.bean.Permit;
import com.qinsoft.frame.messages.WriteMessage;
import com.qinsoft.frame.utils.DbUtil;
import com.qinsoft.frame.utils.TaobaoInter;
import com.taobao.api.response.VasSubscribeGetResponse;


public class PermitDao
{
    public static List<Permit>select(String nick)
    {
        SqlSession sqlMap = null;
        List<Permit> list = new ArrayList<Permit>();
        try 
        {
            //获取连接对象
            sqlMap= DbUtil.getSqlMapClient();
            //获取收费代码
            String tql = "select * from vas.subscribe where nick=chenjianjuncs and article_code=ts-13491";
            VasSubscribeGetResponse response = TaobaoInter.sendInter(tql, VasSubscribeGetResponse.class);
            //执行查询方法
            list = sqlMap.selectList("com.qinsoft.business.permit.sqlMap.permit.select",response.getArticleUserSubscribes());
        }
        catch (Exception e) 
        {
            WriteMessage.WriteErrorLog("com.qinsoft.business.permit.dao.PermitDao.select("+ nick +")", e);
        }
        finally
        {
            sqlMap.close();
        }
        return list;
    }
}
